home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
system
/
ctrlalt.zip
/
CTRLALT.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-12
|
38KB
|
1,318 lines
title CTRLALT
cseg segment
assume cs:cseg, ds:cseg
org 100H
begin: jmp install
ascbuffer label byte
db 13,'CTRLALT Version 1.00 April, 1986',13,10
db 'Copyright R.M.Wilson and B.Simon',26
;--------------------------------------------------------------------------
background = 1FH ; CHANGE COLORS
mainattr = 30H ; HERE FOR ASCII
border = 19H ; TABLES
attrlabel=1BH
monobackground = 07H ; CHANGE MONOCHROME
monomainattr = 70H ; ATTRIBUTES
monoborder = 0FH ; HERE
colxor = 2AH ; Attributes to XOR for highlighting
monoxor = 77H ; for ^@P and ^@<Enter>
asccolxor = 5FH ; ...and, respectively,
ascmonoxor = 0FFH ; for ASCII tables (^@A and H).
colcopyattr = 1EH ; When COPY command is used. 1EH=Yellow/Blue
monocopyattr = 07H ; 07H=White/Black
begoff = 246 ;Offset for upper left corner of decimal ASCII table.
hexbegoff = 166 ;Ditto for hex.
attrbegoff= 1546 ;Ditto for Attribute table.
ansibegoff= 1610 ;Ditto for ANSI table.
callcombo = 0CH ;0CH for Ctrl-Alt, 06H for Ctrl-Shift, 0AH for Shift-Alt.
;------------------------------------------------------------------------
;**** DEFAULTS
attrchar db 24 ;Character used initially by CTRL-ALT-T
drawmode dw 1 ;0-6 Initial mode for Box Drawing (ALT-NUMPAD).
drawdown db 0 ;For Alt-Grey±: 1=dn/rt, 0=neutral, -1=up/lf
;Following are for CTRL-ALT-I
fastflag db 0FFH ;0 if slow, 0FFH if fast inserting is wanted.
carretflag db 0FFH ;0 if backspacing, 0FFH if carriage returns are wanted.
;-------------------------------------------------------------------------
;**** SCAN CODES FOR COMMAND KEYS FOLLOW:
commands db 1FH,2EH,25H,18H,1EH,19H,23H,43H
db 1CH,17H,10H,0CH,0DH,30H,12H
db 0BH,2,3,4,5,6,7
db 14H,13H,8,9,0AH
db 2FH,2CH,31H
;**** CORRESPONDING SUBROUTINES TO JUMP TO:
comaddr dw Switch,Copy,Kill,Otherasc,decAsc,Print,Hexasc,back2dos
dw cUt,Insert,stopstart,slowspeed,fastspeed,Backsp,asciiEnter
dw setdraw,setdraw,setdraw,setdraw,setdraw,setdraw,setdraw
dw showaTtrs,carRets,setdrawup,unsetdrawdown,setdrawdown
dw Vanilla,Zilch,showaNsi
;-------------------------------------------------------------------------
;**** SCAN CODES FOR CTRL-ALT-P SUBCOMMANDS FOLLOW:
prtcoms db 1CH,19H,50H,48H,49H,51H,1EH,1,1FH,4FH,47H,13H
begincodes label byte ;Control codes to prn only below.
db 30H,11H,2EH,20H,14H,3H,16H,9H
db 25H,2,21H,12H,17H,10H,31H,18H
;**** CORRESPONDING SUBROUTINES TO JUMP TO:
prtaddr dw enter,enter,dnarr,uparr,pgup,pgdn,all,esc,pswitch,pend,phome,reset
codeaddr dw bold,wide,cond,dstrike,tiny,charset2,underline,lf8
dw skipperf,unidir,topform,emph,pica,qual,newpage,alloff
;-------------------------------------------------------------------------
;**** SCAN CODES FOR CTRL-ALT-ENTER SUBCOMMANDS FOLLOW:
cutcoms db 16H,50H,48H,4DH,4BH,1H,52H,1CH,17H,37H
db 19H,49H,51H,4EH,4AH,2EH,1FH,47H,4FH
db 12H
;**** CORRESPONDING SUBROUTINES TO JUMP TO:
cutaddr dw ccut,cdnarr,cuparr,crtarr,clfarr,cesc,tack,tack,immenter,prtbox
dw prtbox,cpgdn,cpgup,cgplus,cgminus,ccopy,cswitch,home,end
dw immenter
;-------------------------------------------------------------------------
;**** SCAN CODES FOR CTRL-ALT-A/H SUBCOMMANDS FOLLOW:
asccoms db 30H,12H,48H,50H,4DH,4BH,37H,19H,1
db 47H,4FH,1CH
;**** CORRESPONDING SUBROUTINES TO JUMP TO:
ascaddr dw ascbuff,ascins,ascup,ascdn,ascrt,asclf,ascprn,ascprn,ascesc
dw aschome,ascend,ascins
;------------------------------------------------------------------------------
bold db 27,69,27,71,0FFH ;emph & double strike
dstrike db 27,71,0FFH
underline db 27,45,1,0FFH
tiny db 27,83,1,27,65,5,27,50,15,0FFH
lf8 db 27,48,0FFH
charset2 db 27,54,0FFH
cond db 15,0FFH
wide db 27,87,1,0FFH
skipperf db 27,78,8,0FFH
unidir db 27,85,1,0FFH
topform db 12,0FFH
emph db 27,69,0FFH
pica db 27,58,0FFH ;proprinter
qual db 27,73,2,0FFH ;proprinter
newpage db 27,52,0FFH ;proprinter
alloff db 27,70,27,72,18,27,87,0,27,84,27,79,27,55
db 27,45,0,27,65,12,27,50,27,73,0,13,0FFH
;####################################################################
oldvec = 5CH
oldtvec= 60H
;####################################################################
on_flag db 0 ;1--Marking, 2--^@P
myint: push ax ;Replacement for Interrupt 9.
push ds
sub ax,ax
mov ds,ax
mov al,ds:[417H]
and al,0FH
cmp al,callcombo
je readport
cmp al,8 ;alt
jne exit
cmp cs:drawmode,0
je exit
in al,60H
sub al,47H
jc exit
cmp al,11
ja exit
jmp draw
readport:in al,60H ;Read port to see what happened.
push bp
cld
xor bp,bp
ck:cmp al, cs:commands[bp]
je lets_go
inc bp
cmp bp,offset comaddr - offset commands ;number of commands
jl ck
pop bp
exit: pop ds
pop ax
jmp dword ptr cs:[oldvec]
lets_go: push es
push bx
push cx
push dx
push si
push di
call reset_keyboard
shl bp,1
jmp cs:comaddr[bp]
reset_keyboard:
cli
in al,61H ;This stuff is necessary for PC and XT
mov ah,al ;...could be omitted for AT.
or al,80H
out 61H,al
xchg ah,al
out 61H,al
mov al,20H
out 20H,al
sti
ret
;==========================================
back2dos:mov ah,4CH
int 21H
;==========================================
vanilla: mov ax,0B000H
mov es,ax
mov al,7
jmp short l34
copy: call aim
rep movsw
l34:mov di,1
mov cx,2000
clr:stosb
inc di
loop clr
jmp short endint
kill: call aim
mov ax,720H
rep stosw
jmp short endint
aim: mov cx,2000 ;Sets cx,es,ds,si=di=0,al,xorattr
mov ax,0B000H
xor si,si
xor di,di
mov ds,di
mov bl,byte ptr ds:[410H]
mov ds,ax
mov es,ax
add ah,8H
test bl,10H
je cmon
mov es,ax
mov cs:xorattr,monoxor
mov al,colcopyattr
ret
cmon:mov ds,ax ;color monitor in use
mov cs:xorattr,colxor
mov al,monocopyattr
ret
;==========================================
endint: pop di
endint2: pop si
pop dx
pop cx
pop bx
pop es
pop bp
pop ds
pop ax
iret
;==============================
switch: call aim ; sets si,di,cx,bl
push bx ; get cursor
push cx
mov ah,3
xor bh,bh
int 10H
mov ch,20H ;turn off cursor
mov ah,1
int 10H
pop cx
pop bx
push ds
mov ds,di
xor bl,10H